Skip to content

feat(Tappable): expose onPointerDown and onPointerCancel props #103

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

Wriklend
Copy link

Currently, the Button component in TelegramUI uses a Tappable under the hood, which relies on onPointerDown and onPointerCancel for the ripple effect via the useRipple hook.

But since the Button doesn't explicitly support onPointerDown and onPointerUp props, there's no clean way to hook into these events from the outside. And even if you try to pass them manually through restProps, they end up replacing the internal handlers — which breaks the ripple effect.

@Wriklend
Copy link
Author

Closes #102

@@ -36,8 +48,8 @@ export const Tappable = forwardRef(({
interactiveAnimation === 'opacity' && styles['wrapper--opacity'],
className,
)}
onPointerCancel={onPointerCancel}
onPointerDown={onPointerDown}
onPointerCancel={handlePointerCancel}
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for your issue and contribution!
It would be preferred to use function callMultiple

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@mainsmirnov yep, good one

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants